<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>

<body>
    <div id ="app">


     
        

       <h1> 组件的最大特性就是复用性，而用好插槽能大大提高组件的可复用能力</h1>

        <com1>

            <div> 你好</div>
        </com1>
  <hr>


        <com1>

            <div> hello</div>
        </com1>
    </div>

    

    <template  id='com1'>
        <div>
            <h1> {{msg}}</h1>
            <slot></slot>    
        </div>
    </template>

    <script>
   let  com1={
       template:'#com1',
       data() {
           return {
               msg:'com1 组件'
           }
       }
   }


     //创建Vue实例,得到 ViewModel
     var vm = new Vue({
        el: '#app',
        data: {},
        methods: {},
        components:{
            com1
        }
     });
    </script>
</body>

</html>